package com.sinohb.autonomousdriving_test;

import android.app.Application;
import android.util.Log;
import androidx.annotation.NonNull;
import java.util.Objects;

public class SQApp extends Application implements Thread.UncaughtExceptionHandler {
    private Thread.UncaughtExceptionHandler mDefaultExceptionHandler;

    @Override
    public void onCreate() {
        super.onCreate();

        mDefaultExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
        Thread.setDefaultUncaughtExceptionHandler(this);
    }

    @Override
    public void uncaughtException(@NonNull Thread t, @NonNull Throwable e) {
        Log.e("uncaughtException======================================", Objects.requireNonNull(e.getMessage()));
        if (mDefaultExceptionHandler != null)
            mDefaultExceptionHandler.uncaughtException(t, e);
    }
}
